import traceback

from obs import ObsClient
async def upload_stream(filename,content):
    access_key_id = 'OZ0WAD9NZ9NLSZEOEL9L',
    # secret_access_key='M3zFdWw5CeGUsF3LhlVSe7AIYMN3uSP5ORhyMrbg',
    secret_access_key = '3UxoVl2AQlMTWhWpMoF60kPa4QjDfyKvuv8dXyn3',
    # 创建ObsClient实例
    obsClient = ObsClient(
        access_key_id='OZ0WAD9NZ9NLSZEOEL9L',
        secret_access_key='3UxoVl2AQlMTWhWpMoF60kPa4QjDfyKvuv8dXyn3',
        server='https://obs.cn-south-1.myhuaweicloud.com',
        ssl_verify=False,
        max_retry_count=1,
        timeout=20,
        chunk_size=65536,
        long_conn_mode=True
    )
    resp = obsClient.putObject('changst',filename,content)
    if resp.status > 300:
        print('errorCode:', resp.errorCode)
        print('errorMessage:', resp.errorMessage)
        return False,resp.errorMessage
    else:
        return True,''